package com.gh.controller.admin;

import com.gh.common.result.R;
import com.gh.entity.LendItem;
import com.gh.service.LendItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Eric Fang
 * @version 1.0
 * @date 2021/10/31 16:15
 */
@Api(tags = "标的出借记录")
@Slf4j
@RestController
@RequestMapping("/admin/core/lendItem")
@RequiredArgsConstructor
public class AdminLendItemController {

    private final LendItemService lendItemService;

    @ApiOperation("获取列表")
    @GetMapping("/list/{lendId}")
    public R list(@ApiParam(value = "标的id", required = true)
                  @PathVariable Long lendId) {
        List<LendItem> lendItemList = lendItemService.selectByLendId(lendId);
        return R.ok().data("list", lendItemList);
    }
}
